package com.wans.ssq.common.util;

import com.wans.common.constans.CustomExceptionEnum;
import com.wans.common.exception.CustomRunningException;
import com.wans.model.lottery.ssq.dtos.UserRecordDTO;

public class UserRecordDTOValidationUtils {

    public static boolean validate(UserRecordDTO dto) {

        if (dto == null || dto.getCode() == null || dto.getRedValue() == null || dto.getBlueValue() == null)
            // 数据不完整
            throw new CustomRunningException(CustomExceptionEnum.USER_SSQ_DATA_ERROR);

        if(dto.getRedValue().size()< 6 || dto.getBlueValue().isEmpty())
            // 不是一注数据 不满足 6-1
            throw new CustomRunningException(CustomExceptionEnum.USER_SSQ_NON_FULL_ERROR);

        if (dto.calculateBetCount() > 100)
            // 总投注大于 100 注
            throw new CustomRunningException(CustomExceptionEnum.USER_SSQ_BET_DATA_ERROR);


        return true;
    }

}
